
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>头条热门原创图文推送助手</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="/static/css/dashboard.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container-fluid">
            <a class="navbar-brand" href="/">
                <i class="fas fa-newspaper"></i> 头条助手
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto">
                    <li class="nav-item">
                        <a class="nav-link active" href="#articles">文章管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#settings">设置</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container-fluid mt-4">
        <div class="row">
            <div class="col-md-3">
                <div class="card">
                    <div class="card-header bg-light">
                        <h5 class="mb-0">快速操作</h5>
                    </div>
                    <div class="card-body">
                        <button class="btn btn-primary w-100 mb-2" onclick="generateArticles()">
                            <i class="fas fa-magic"></i> 生成今日文章
                        </button>
                        <button class="btn btn-success w-100 mb-2" onclick="refreshArticles()">
                            <i class="fas fa-sync"></i> 刷新列表
                        </button>
                        <div class="mt-3">
                            <h6>筛选状态</h6>
                            <select class="form-select" id="statusFilter" onchange="filterArticles()">
                                <option value="">全部</option>
                                <option value="draft">草稿</option>
                                <option value="published">已发布</option>
                                <option value="rejected">已拒绝</option>
                            </select>
                        </div>
                    </div>
                </div>

                <div class="card mt-3">
                    <div class="card-header bg-light">
                        <h5 class="mb-0">统计信息</h5>
                    </div>
                    <div class="card-body">
                        <p><strong>总文章数：</strong><span id="totalCount">0</span></p>
                        <p><strong>草稿数：</strong><span id="draftCount">0</span></p>
                        <p><strong>已发布：</strong><span id="publishedCount">0</span></p>
                        <p><strong>今日生成：</strong><span id="todayCount">0</span></p>
                    </div>
                </div>
            </div>

            <div class="col-md-9">
                <div class="card">
                    <div class="card-header bg-light">
                        <h5 class="mb-0">文章列表</h5>
                    </div>
                    <div class="card-body">
                        <div id="loadingSpinner" class="text-center">
                            <div class="spinner-border" role="status">
                                <span class="visually-hidden">加载中...</span>
                            </div>
                        </div>
                        <div id="articlesContainer" class="row"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 文章详情模态框 -->
    <div class="modal fade" id="articleModal" tabindex="-1">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">文章详情</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <div id="articleDetails"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="publishBtn" onclick="publishArticle()">发布文章</button>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
    <script src="/static/js/dashboard.js"></script>
</body>
</html>
